// 类型
// 变量声明：类型 = 值
// 布尔
const bool: boolean = true
const bool1: boolean = false

// 数字
const num: number = 123

// 字符串
const str1: string = '123'
const str2: string = "123"
const str3: string = `123`


// 数组
const arr: number[] = [1, 2, 3, 4, 5]
const arr1: (boolean | number | string)[] = [true, false, 1, '123']

// 元组
const tuple1: [number, string] = [1, '123']
// const [value, setValue] = useState(1)


// 枚举
enum Color {
	Red,
	Yellow,
	Green
}

console.log(Color.Red)
console.log(Color[0])

// any : 类型检查器直接让它们通过编译阶段的检查

let a: any = 1;
a = 2
a = 123123
a = 2342
a = true
a = [1, 2, 3]
a = {}
a = new Date()
a = () => { }

// Void: 函数没有返回值  返回值类型void
const fn = () => { }

// Null 和 Undefined

const n: null = null
const u: undefined = undefined

let num123: number = null

// Never 类型表示的是那些永不存在的值的类型

// function fnn(): never {
// 	while (true) {
// 		console.log(123)
// 	}
// }

// // 推断的返回值类型为never
// function fail() {
// 	return error("Something failed");
// }

// Object: 很遗憾 没啥用

const o1: object = {}
const o2: object = () => { }
const o3: object = []
const o4: object = new Date()
const o5: object = new FileReader()
const o6: object = new Number(123)
// unknown： 未来类型
let aa: unknown = 123
aa = '12312313'
aa = []
let ab: unknown = {}
let ac: unknown = [1231231]